//setpassword.js
let timer;

Page({
  data: {
    transparent: 0.3,
    getCode: '获取验证码',
    noUse:false,
    payverify: '',
    paysword:''
  },
  onLoad: function () {
    
  },
  getCode: function () {
    let that = this;
    let time = 61;
    // let newNum = that.data.newphone;
    // if (newNum != '') {
    console.log(1)
      timer = setInterval(function(){
         time--;
         if(time==-1){
             clearInterval(timer);
             that.setData({
               getCode: '获取验证码',
               noUse:false
             })
         }else{
             that.setData({
               getCode: time + 'S',
               noUse:true
            })
         }            
       },1000)
    // }
  },
  payverify: function (e) {
    let that = this;
    let payverify = e.detail.value;
    if(payverify != ''){
      that.setData({
         payverify:payverify
      })
      if (that.data.paysword != '' && that.data.paysword.length == 6) {
        that.setData({
           transparent:1
        })
      }
    } else {
      that.setData({
           transparent:0.3
      })
    }
  },
  paysword: function (e) {
    let that = this;
    let paysword = e.detail.value;
    if(paysword != '' && paysword.length == 6){
       that.setData({
         paysword:paysword
       })
      if (that.data.payverify != '') {
         that.setData({
           transparent:1
         })
      }
    } else {
        that.setData({
           transparent:0.3
        })
    }
  }
})
